package com.itheima.controller;


import cn.itheima.health.entity.Result;
import cn.itheima.health.resources.DateUtils;
import cn.itheima.health.resources.MessageConstant;
import cn.itheima.health.resources.POIUtils;
import cn.itheima.health.service.OrderSettingService;
import com.itheima.pojo.OrderSetting;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {





    @RequestMapping("/findUsername.do")
    public Result findUsername(Authentication authentication){
        try {
          // Authencation
            String username = authentication.getName();
//            SecurityContextHolder.getContext().getAuthentication().get
            return  new Result(true, MessageConstant.GET_USERNAME_SUCCESS,username);
        } catch (Exception e) {
            e.printStackTrace();
            return  new Result(false, MessageConstant.GET_USERNAME_FAIL);
        }

    }



}
